/**
 * DSM - Distributed Search Manager
 * Developed by Milspec Research International Pty Ltd
 * $Author: gsingh $
 * $Revision: 1.4 $
 * $Date: 2005/09/13 09:15:17 $
 * (c)Copyright 2004
 * education.au limited
 * DEST
 * All rights reserved.
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * Redistributions of source code must retain the above copyright notice, this
 * list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.
 * Neither the names education.au limited, DEST nor the names of its
 * contributors may be used to endorse or promote products derived from this
 * software without specific prior written permission.
 * To the extent permitted by law, the copyright owners of this software and
 * its contributors:
 * (i) exclude all warranties in relation to the software; and
 * (ii) exclude liability for all losses, costs, expenses and damages arising
 * in any way from the use of the software whether arising from or in
 * relation to breach of contract, negligence or any other tort, in equity
 * or otherwise. If the software is in breach of a warranty which is
 * implied by law, the copyright owners and contributors liability is
 * limited to the replacement of the software.
 *
 * @author	gsingh
 */

package au.edu.educationau.opensource.dsm.adapters;

import java.util.Properties;

/**
 * The Search Adapter's properties. All information that is required to
 * configure this adapter to allow it to either be re-used or set for single
 * repository use only. It is read by the SearchAdapter implemented class.
 * 
 */

public final class SearchAdapterProperties extends java.lang.Object implements java.io.Serializable {
	/** The unique code for this adapter */
	private String adapterCode = "";
	/** The Display Title for this adapter */
	private String displayTitle = "";
	/** The Display Description for this adapter */
	private String description = "";
	/** The Human Readable website URL for this adapter */
	private String websiteUrl = "";
	/** The Human Viewable logo for this adapter */
	private String imageUrl = "";
	/** The actual search URL for this adapter */
	private String searchUrl = "";
	/** Method to use when requesting the searchUrl */
	private String method = "";
	/** The URL for the category information for this adapter */
	private String categoryURL = "";
	/** The priority interleaving default for this adapter */
	private int priority = 0;
	/** The result mix factor for this adapter */
	private int resultMixFactor = 0;
	/** The number of results to obtain in one request for this adapter */
	private int batchSize = 0;
	/** The amount to multiply with the obtained relevance */
	private float relevanceMultiplier = 0f;
	/** The amount to add to the obtained relevance */
	private float relevanceOffset = 0f;
	/** Re-rank this result using word count algorithm */
	private boolean reRank = false;
	/** Extra properties for this adapter */
	private Properties extraProperties = new Properties();

	/**
	 * Sets the unique adapter code
	 * 
	 * @param adapterCode
	 */
	public void setAdapterCode(String adapterCode) {
		this.adapterCode = adapterCode;
	}

	/**
	 * Gets the unique adapter code
	 * 
	 * @return adapterCode
	 */
	public String getAdapterCode() {
		return adapterCode;
	}

	/**
	 * Sets the Display Title as seen in the result set or in the search form
	 * 
	 * @param displayTitle
	 */
	public void setDisplayTitle(String displayTitle) {
		this.displayTitle = displayTitle;
	}

	/**
	 * Gets the Display Title as seen in the result set or in the search form
	 * 
	 * @return displayTitle
	 */
	public String getDisplayTitle() {
		return displayTitle;
	}

	/**
	 * Sets the Description as seen in the XML search results.
	 * 
	 * @param description
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * Gets the Description as seen in the XML search results.
	 * 
	 * @return description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * Sets the Human Readable website URL
	 * 
	 * @param websiteUrl
	 */
	public void setWebsiteURL(String websiteUrl) {
		this.websiteUrl = websiteUrl;
	}

	/**
	 * Gets the Human Readable website URL
	 * 
	 * @return websiteUrl
	 */
	public String getWebsiteURL() {
		return websiteUrl;
	}

	/**
	 * Sets the Human Viewable logo URL
	 * 
	 * @param imageUrl
	 */
	public void setImageURL(String imageUrl) {
		this.imageUrl = imageUrl;
	}

	/**
	 * Gets the Human Viewable logo URL
	 * 
	 * @return imageUrl
	 */
	public String getImageURL() {
		return imageUrl;
	}

	/**
	 * Sets the actual search URL
	 * 
	 * @param searchUrl
	 */
	public void setSearchURL(String searchUrl) {
		this.searchUrl = searchUrl;
	}

	/**
	 * Gets the actual search URL
	 * 
	 * @return searchUrl
	 */
	public String getSearchURL() {
		return searchUrl;
	}

	/**
	 * Sets the method to use when requesting the searchUrl
	 * 
	 * @param method
	 */
	public void setMethod(String method) {
		this.method = method;
	}

	/**
	 * Gets the method to use when requesting the searchUrl
	 * 
	 * @return method
	 */
	public String getMethod() {
		return method;
	}

	/**
	 * Sets the URL for the category information
	 * 
	 * @param categoryURL
	 */
	public void setCategoryURL(String categoryURL) {
		this.categoryURL = categoryURL;
	}

	/**
	 * Gets the URL for the category information
	 * 
	 * @return categoryURL
	 */
	public String getCategoryURL() {
		return categoryURL;
	}

	/**
	 * Sets the priority interleaving default
	 * 
	 * @param priority
	 */
	public void setPriority(int priority) {
		this.priority = priority;
	}

	/**
	 * Gets the priority interleaving default
	 * 
	 * @return priority
	 */
	public int getPriority() {
		return priority;
	}

	/**
	 * Sets the result mix factor for this adapter
	 * 
	 * @param resultMixFactor
	 */
	public void setResultMixFactor(int resultMixFactor) {
		this.resultMixFactor = resultMixFactor;
	}

	/**
	 * Gets the result mix factor for this adapter
	 * 
	 * @return resultMixFactor
	 */
	public int getResultMixFactor() {
		return resultMixFactor;
	}

	/**
	 * Sets the number of results to obtain in one request for this adapter
	 * 
	 * @param batchSize
	 */
	public void setBatchSize(int batchSize) {
		this.batchSize = batchSize;
	}

	/**
	 * Gets the number of results to obtain in one request for this adapter
	 * 
	 * @return batchSize
	 */
	public int getBatchSize() {
		return batchSize;
	}

	/**
	 * Sets the amount to multiply with the obtained relevance
	 * 
	 * @param relevanceMultiplier
	 */
	public void setRelevanceMultiplier(float relevanceMultiplier) {
		this.relevanceMultiplier = relevanceMultiplier;
	}

	/**
	 * Gets the amount to multiply with the obtained relevance
	 * 
	 * @return relevanceMultiplier
	 */
	public float getRelevanceMultiplier() {
		return relevanceMultiplier;
	}

	/**
	 * Sets the amount to add to the obtained relevance
	 * 
	 * @param relevanceOffset
	 */
	public void setRelevanceOffset(float relevanceOffset) {
		this.relevanceOffset = relevanceOffset;
	}

	/**
	 * Gets the amount to add to the obtained relevance
	 * 
	 * @return relevanceOffset
	 */
	public float getRelevanceOffset() {
		return relevanceOffset;
	}

	/**
	 * Re-rank this result using word count algorithm as specified in
	 * SearchResultSorter
	 * 
	 * @param reRank
	 */
	public void setReRank(boolean reRank) {
		this.reRank = reRank;
	}

	/**
	 * Re-rank this result using word count algorithm as specified in
	 * SearchResultSorter
	 * 
	 * @return reRank
	 */
	public boolean getReRank() {
		return reRank;
	}

	/**
	 * Sets the extra properties for this adapter
	 * 
	 * @param extraProperties
	 */
	public void setExtraProperties(Properties extraProperties) {
		this.extraProperties = extraProperties;
	}

	/**
	 * Gets an extra Property
	 * 
	 * @return extra Property
	 */
	public String getExtraProperty(String key) {
		return extraProperties.getProperty(key);
	}

	/** Class name formatted display */
	public String toString() {
		return "o.m.d.a.SearchAdapterProperties" + "_" + adapterCode;
	}

	/** Debugs the properties to the log or console */
	public void summary() {
		System.err.println("[adapterCode=" + adapterCode + "]");
		System.err.println("[displayTitle=" + displayTitle + "]");
		System.err.println("[websiteUrl=" + websiteUrl);
		System.err.println("[imageUrl=" + imageUrl);
		System.err.println("[searchUrl=" + searchUrl + "]");
		System.err.println("[method=" + method + "]");
		System.err.println("[priority=" + priority + "]");
		System.err.println("[resultMixFactor=" + resultMixFactor + "]");
		System.err.println("[batchSize=" + batchSize + "]");
		System.err.println("[relevanceMultiplier=" + relevanceMultiplier + "]");
		System.err.println("[relevanceOffset=" + relevanceOffset + "]");
		System.err.println("[reRank=" + reRank + "]");
	}
}

// -- EOF
